<?php
	require_once(dirname(__FILE__)."/../config/config.main.php");
	require_once(dirname(__FILE__).'/../config/config.language.php');
	class Widgets {
		function searchBar() {
			return '<input type="text"><input type="submit" value="Search">';	
		}
		function userBar() {
			if(isset($_SESSION['userData'])) {
				// Do something
			} else {
				return 'Welcome, Guest. <a href="register/">(register)</a>';	
			}
		}
		function getLinks() {
			$arr = array(
				array('URL' => '{$RootURL}map/', 'ALT' => 'XEvoMap Overview', 'TEXT' => 'Map'),
				array('URL' => '{$RootURL}register/', 'ALT' => 'Register with XEvoMap', 'TEXT' => 'Register'),
				array('URL' => '{$RootURL}login/', 'ALT' => 'Log in to XEvoMap', 'TEXT' => 'Log In'),
				array('URL' => '{$RootURL}user/', 'ALT' => 'View your XEvoMap Account Details', 'TEXT' => 'My Account'),
			);
			foreach($arr as $index => $row) {
				$arr[$index]['URL'] = $this->replaceDefines($row['URL']);
			}
			return $arr;
		}
		function replaceDefines($text) {
			$defines = array(
				'RootURL' => ROOT_WEB,
				'TemplatesURL' => TEMPLATES_WEB,
			);
			foreach($defines as $define => $val) {
				$text = str_replace('{$'.$define.'}', $val, $text);
			}
			return $text;
		}
	}
?>